// https://umijs.org/config/
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
const { REACT_APP_ENV } = process.env;
export default defineConfig({
  hash: true,
  antd: {},
  dva: {
    hmr: true,
  },
  locale: {
    // default zh-CN
    default: 'zh-CN',
    // default true, when it is true, will use `navigator.language` overwrite default
    antd: true,
    baseNavigator: true,
  },
  dynamicImport: {
    loading: '@/components/PageLoading/index',
  },
  targets: {
    ie: 11,
  },
  // umi routes: https://umijs.org/docs/routing
  routes: [
    {
      path: '/user',
      component: '../layouts/UserLayout',
      routes: [
        {
          name: 'login',
          path: '/user/login',
          component: './user/login',
        },
        {
          name: 'signin',
          path: '/user/signin',
          component: './user/signin',
        },
      ],
    },
    {
      path: '/',
      component: '../layouts/SecurityLayout',
      routes: [
        {
          path: '/',
          component: '../layouts/BasicLayout',
          routes: [
            {
              path: '/',
              redirect: '/welcome',
            },
            {
              path: '/welcome',
              name: 'welcome',
              icon: 'smile',
              component: './Welcome',
              closable: false,
              hideInMenu:true,
            },
            {
              path: '/basic',
              name: 'basic',
              icon: 'form',
              //authority: ['BASIC_ENTERPRISE','BASIC_CUSTOMER','BASIC_REGION','BASIC_EMPLOYEE'],
              routes: [
                {
                  name: 'enterprise',
                  icon: 'Solution',
                  path: '/basic/enterprise',
                  component: './basic/enterprise',
                  //authority: ['BASIC_ENTERPRISE'],
                },
                {
                  name: 'product',
                  icon: 'AppstoreAdd',
                  path: '/basic/product',
                  component: './basic/product',
                },
                {
                  name: 'device',
                  icon: 'setting',
                  path: '/basic/device',
                  component: './basic/device',
                },
              ]
            },
            {
              path: 'devops',
              icon: 'Solution',
              name: 'devops',
              routes:[
                {
                  name: 'monitor',
                  icon: 'AppstoreAdd',
                  path: '/devops/monitor',
                  component: './devops/monitor',
                },
                {
                  name: 'log',
                  icon: 'Reconciliation',
                  path: '/devops/log',
                  component: './devops/log',
                },
                {
                  name: 'debug',
                  icon: 'AndroidOutlined',
                  path: '/devops/debug',
                  component: './devops/debug',
                },
              ]
            },
            {
              path: 'system',
              icon: 'team',
              name: 'system',
              routes:[
                {
                  name: 'user',
                  icon: 'team',
                  path: '/system/user',
                  component: './system/user',
                },
              ]
            },
            {
              component: './404',
            },
          ],
        },
        {
          component: './404',
        },
      ],
    },
    {
      component: './404',
    },
  ],
  // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  theme: {
    // ...darkTheme,
    'primary-color': defaultSettings.primaryColor,
  },
  // @ts-ignore
  title: false,
  ignoreMomentLocale: true,
  proxy: proxy[REACT_APP_ENV || 'dev'],
  manifest: {
    basePath: '/',
  },
});
